Skip to content

Conversation

zyfy29
Copy link
Contributor

@zyfy29 zyfy29 commented Oct 14, 2025

BREAKING CHANGE: This changes some optional struct fields with pointer types.

Fixes: #3775.

Rename the custom linter sliceofpointers to gogithub, and expand it with omitempty tag check.

@zyfy29 zyfy29 force-pushed the linter-omitempty-2 branch from 453a2be to e8329a2 Compare October 14, 2025 13:12
@gmlewis
Copy link
Collaborator

gmlewis commented Oct 14, 2025

@zyfy29 - just FYI: #3781 should fix the lint/test failures.

@gmlewis gmlewis added NeedsReview PR is awaiting a review before merging. Breaking API Change PR will require a bump to the major version num in next release. Look here to see the change(s). labels Oct 14, 2025
Copy link

codecov bot commented Oct 14, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.50%. Comparing base (d94f5c9) to head (bab5e6d).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #3780   +/-   ##
=======================================
  Coverage   91.50%   91.50%           
=======================================
  Files         190      190           
  Lines       17007    17019   +12     
=======================================
+ Hits        15562    15574   +12     
  Misses       1257     1257           
  Partials      188      188           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@gmlewis
Copy link
Collaborator

gmlewis commented Oct 14, 2025

@zyfy29 - This PR is going to be extremely tricky. I'm looking just at the very first example in github/actions_hosted_runners.go, and am noticing that in lines 109-128, the validation function goes to great lengths to ensure that required fields are not missing, which makes me think that the correct fix for this struct is to actually REMOVE the omitempty on all the required fields (and NOT change the values to pointers).

In fact, the more that I think about this, the more I remember a large number of bug reports in this repo have involved either the inclusion or lack of inclusion of the omitempty field, along with whether the field was a pointer or a value.

I'm seriously thinking (now that I've seen the wide-sweeping changes for this linter) that we may not want this linter at all because each and every case is so closely tied to how it behaves and interacts with the respective GitHub endpoints. I'm concerned that this one PR is going to cause a great deal of breakages.

Thoughts?

@zyfy29
Copy link
Contributor Author

zyfy29 commented Oct 14, 2025

Yes, it may break a lot of methods. The violations are far more than what I thought before since I just made a incomplete search. Let me think carefully tomorrow.

@zyfy29 zyfy29 closed this Oct 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Breaking API Change PR will require a bump to the major version num in next release. Look here to see the change(s). NeedsReview PR is awaiting a review before merging.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

linter for detect json:"omitempty" usage with value types

2 participants